<?php
error_reporting(E_ALL);
	require_once '../../defines.php';
	require_once '../../User/user.php';
	require_once '../../includes/header.php';
	require_once '../../DB/connect.php';
	
	if(isset($_POST["bugsubmit"])){
		$title = $_REQUEST["title"];
		$desc = $_REQUEST["description"];
		$files = $_REQUEST["files"];
		
		$title = mysql_real_escape_string($title);
		$desc = mysql_real_escape_string($desc);
		$files = mysql_real_escape_string($files);
		$user = $_SESSION["user"];
		
		if($title != null && $desc != null){
			$query = "INSERT INTO bugs (id, title, description, files, username, datetime) VALUES (NULL , '$title', '$desc', '$files', '$user', now())";
			mysql_query($query);
		}
		header("Location: http://".HOST."/DevManagement/Reports/Bug/showbugs.php");
	}
	else{
		header("Location: http://".HOST."/DevManagement/main.php");
	}
	require_once '../DB/disconnect.php';
	require_once '../../includes/footer.php';
?>